<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/commonEdit.jsp"%>
<html>
<head>
<script type="text/javascript" src="${ctx }/scripts/div/common.js"></script>
<script type="text/javascript">
  /**
   * 功能描述： 全选复选框，全选，取消是全部取消
   *@param obj 全选复选框
   */
  function selectAll(obj){
  	   var handoverGoods = document.getElementsByName("handoverGood");
       var len = handoverGoods.length;
       if(obj.checked){
         for(var i = 0; i< len;i++){
           handoverGoods[i].checked=true;
         }
       }else{
			for(var i = 0; i< len; i++){
			  handoverGoods[i].checked=false;
			}
       }
  }

  /**
   * 功能描述： 如果有一个选项为取消，则全选复选框取消
   * @parem check 选择的复选框
   */
   function cancelAll(check){;
     if(!check.checked){
        document.getElementById("chkAll").checked = false;
     }
   }
  /**
   * 功能描述：把选中的信息显示到父窗体中
   */
   function setParentInfo(){
	 var handoverGoods = document.getElementsByName("handoverGood");
	 var len = handoverGoods.length;
	 var j = 0;
	 var goodIds = "";  //移交物品的Id 多个物品，用逗号分开
	 var goodNames = ""; //移交物品的名称，多个物品用逗号分开
	 var parentId = "${parentFrameId}";
     for(var i = 0; i < len; i++){
	    if(handoverGoods[i].checked){
	        goodIds += handoverGoods[i].value+",";
			goodNames  += handoverGoods[i].dataFld + ",";
			j++;
	  	}
	 }

	  var parent = findFrame(parentId);
      if(parent != undefined){
         if(j > 0 ){
         	goodIds = goodIds.substring(0,goodIds.length-1);
         	goodNames = goodNames.substring(0,goodNames.length-1);
         	parent.setHandoverGoods(goodIds,goodNames);
         }else{
           	parent.setHandoverGoods("","");
         }
     }

	 windowClose();
   }


	function init(){
		var goodIds = '${goodIds}';
		if (goodIds != null && goodIds != ""){
			//var
		}
	}

</script>
</head>

<body onload="init();">

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class="window_head_outBg"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><img src="${ctx }/images/ico_Advance.gif" width="16" height="16" align="absmiddle"> <span class="window_head_intext">${key.chooseGoods }</span></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td class="aux_header_line_1"></td>
  </tr>
  <tr>
    <td class="aux_header_line_2"></td>
  </tr>
  <tr>
    <td class="content">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
	  <tr>
        <td valign="middle" class="aux_outtable_color"><label></label>
        <div style="height:100px;overflow:auto;">
         <table width="100%" border="0" cellpadding="0" cellspacing="1" class="aux_intable_color">
          <tr><td colspan="2" class="aux_titletable"><input type="checkbox" name="chkAll" id="chkAll" value="checkbox" onclick="selectAll(this);"> ${key.allChoose } </td></tr>

          <c:forEach var="good" items="${goods}">
           <tr>
            <td class="aux_intable_td1" width="40%">
	            <table width="0%" border="0" cellspacing="0" cellpadding="0" style="table-layout:fixed">
	              <tr ><td  width="20%"><input name="handoverGood" type="checkbox" value="${good.keyword }" checked onclick="cancelAll(this);"  dataFld="${good.name }"></td>
	                  <td  width="80%" nowrap title="${good.name}" >&nbsp; ${good.name}</td>
	              </tr>
	            </table>
            </td>
            <td class="aux_intable_td2" width="60%" >
            	<table width="0%" border="0" cellspacing="0" cellpadding="0" style="table-layout:fixed">
	              <tr><td nowrap title="${good.remark}" >&nbsp; ${good.remark}</td></tr>
	            </table>
	        </td>
          </tr>
          </c:forEach>

        </table>
        </div>
          </td>
	  </tr>
    </table>
    </td>
  </tr>
  <tr>
    <td class="window_footer"><table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_21"></td>
              <td class="buttonOffMiddle" id="btn1_22" onClick="setParentInfo();" onMouseOver="btn_change_over(2)" onMouseOut="btn_change_out(2)" onblur="btn_change(2)"><img src="${ctx }/images/ico_ok.gif" alt="" width="14" height="14" border="0" align="absbottom">${key.confirm }</td>
              <td class="buttonOffRight" id="btn1_23"></td>
            </tr>
        </table></td>
        <td class="btn_between_space"></td>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_31"></td>
              <td class="buttonOffMiddle" id="btn1_32" onClick="windowClose();" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)" onblur="btn_change(3)"><img src="${ctx }/images/ico_cancel.gif" alt="" width="14" height="14" border="0" align="absbottom">${key.cancel }</td>
              <td class="buttonOffRight" id="btn1_33"></td>
            </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>

</body>
</html>